<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Name:  Students Model
*
* Author:  Ervin R. Musngi
*
*/

class School_level_m extends DataMapperExt
{
	var $has_many	= array(
					'section_lists'		=>	array(
							'class'			=> 'section_m',
							'other_field'	=> 'school_level',
							'join_self_as' 	=> 'school_level',
							'join_other_as' => 'section',
							'join_table'	=> 'sections'
							
					),
					'sections'		=>	array(
							'class'			=> 'section_m',
							'other_field'	=> 'school_level',
							'join_self_as' 	=> 'school_level',
							'join_other_as' => 'section',
							'join_table'	=> 'section_listings'
							
					),
					'students'		=>	array(
							'class'			=> 'student_m',
							'other_field'	=> 'school_level',
							'join_self_as' 	=> 'school_level',
							'join_other_as' => 'student',
							'join_table'	=> 'student_sections'
					),
					'section_listings'	=> array(
							'class'			=> 'section_listing_m',
							'other_field'	=> 'section_listings',
							'join_self_as'	=> 'school_level',
							'join_table'	=> 'section_listings'
					),
					'subjects'			=> array(
							'class'			=> 'subjects_m',
							'other_field'	=> 'school_level',
							'join_self_as'	=> 'school_level',
							'join_table'	=> 'subjects'
					),
					'subject_listings'	=> array(
							'class'			=> 'subject_listing_m',
							'other_field'	=> 'school_level_listings',
							'join_self_as'	=> 'school_level',
							'join_table'	=> 'subject_listings'
					)
				);
	var $has_one	= array(
					'school_year'	=> array(
							'class'			=> 'school_year_m',
							'other_field'	=> 'school_levels',
							'join_self_as'	=> 'school_level',
							'join_other_as'	=> 'school_year',
							'join_table'	=> 'section_listings'
					)
				);
			
	var $table = 'school_levels';
}